package com.csun.cmny.provider.service.impl;

import com.csun.cmny.provider.model.domain.MqMessageData;
import com.csun.cmny.provider.model.dto.SendWebSocketRequest;
import com.csun.cmny.provider.service.OpcManager;
import com.csun.cmny.provider.service.OpcWebSocketService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @Auther: chisj chisj@foxmal.com
 * @Date: 2019-10-11 13:41
 * @Description:
 */
@Service
public class OpcWebSocketServiceImpl implements OpcWebSocketService {

    @Resource
    private OpcManager opcManager;
    @Resource
    private WebSocketProducer webSocketProducer;

    /**
     * 发送websocket消息
     *
     * @param sendWebSocketRequest
     */
    @Override
    public void sendWebSocketMessage(SendWebSocketRequest sendWebSocketRequest) {

        MqMessageData mqMessageData = webSocketProducer.sendWebSocketMq(sendWebSocketRequest);

        opcManager.sendWebSocketMessage(mqMessageData);
    }
}
